<?php

require_once 'sdk/client.php';
require_once 'sdk/charge.php';
require_once 'sdk/renew.php';
require_once 'sdk/info.php';
require_once 'sdk/device_log.php';
require_once 'sdk/device_state.php';
require_once 'constants/constants.php';

use SDK\Client;
use SDK\Charge;
use SDK\Renew;
use SDK\Info;
use SDK\DeviceLog;
use SDK\DeviceState;
use Constants\ChargeMode;

$appId = "请联系万桩工作人员获取";
$appSecret = "请联系万桩工作人员获取";
$baseURL = "请联系万桩工作人员获取";
$deviceNum = "请联系万桩工作人员获取";
$tradeNo = "请联系万桩工作人员获取";

$client = new Client($appId, $appSecret,$baseURL);
$chargeClient =  new Charge($client);

// ChargeStart
$chargeMode = ChargeMode::ChargeModeEnergyMode;
$res = $chargeClient->chargeStart([
    'charge_mode' => $chargeMode,
    'device_port' => '1',
    'charge_id' => 10033,
    'total_fee' => 100,
    'device_num' => $deviceNum
]);
echo "ChargeStart =====> ";
print_r($res);
 
// ChargeStop
$res = $chargeClient->chargeStop([
    'device_port' => '1',
    'charge_id' => 10033,
    'device_num' => $deviceNum
]);
echo "ChargeStop ===========> ";
print_r($res);




$renewClient =  new Renew($client);

// GetCompanyExpireDeviceList
$rescedl = $renewClient->getCompanyExpireDeviceList([
    'page' => 1,
    'limit' => 10]);
echo "GetCompanyExpireDeviceList =====> ";
print_r($rescedl);

// CreateCompanyRenewOrder
$rescro = $renewClient->createCompanyRenewOrder([
    'out_trade_no' => $tradeNo,
    'device_nums' => [$deviceNum]
]);
echo "CreateCompanyRenewOrder =====> ";
print_r($rescro);

// GetCompanyRenewStatus
$rescrs = $renewClient->getCompanyRenewStatus([
    'out_trade_no' => $tradeNo
]);
echo "GetCompanyRenewStatus =====> ";
print_r($rescrs);


$infoClient =  new Info($client);

// GetDeviceSettingOnlineCardInfo
$resdsoci = $infoClient->getDeviceSettingOnlineCardInfo([
    'device_num' => $deviceNum
]);
echo "GetDeviceSettingOnlineCardInfo =====> ";
print_r($resdsoci);


// GetDeviceSettingSafetyInfo
$reso = $infoClient->getDeviceSettingSafetyInfo([
    'device_num' => $deviceNum
]);
echo "GetDeviceSettingSafetyInfo =====> ";
print_r($reso);

// GetDeviceModeTimeInfo
$resmti = $infoClient->getDeviceModeTimeInfo([
    'device_num' => $deviceNum
]);
echo "GetDeviceModeTimeInfo =====> ";
print_r($resmti);

// GetDeviceModeTime1Info
$resmt1i = $infoClient->getDeviceModeTime1Info([
    'device_num' => $deviceNum
]);
echo "GetDeviceModeTime1Info =====> ";
print_r($resmt1i);

// GetDeviceSettingCoinInfo
$ressci = $infoClient->getDeviceSettingCoinInfo([
    'device_num' => $deviceNum
]);
echo "GetDeviceSettingCoinInfo =====> ";
print_r($ressci);

// FindMultiDevices
$resfmd = $infoClient->findMultiDevices([
    'device_nums' => [$deviceNum]
]);
echo "FindMultiDevices =====> ";
print_r($resfmd);

// DeviceAdd
$resda = $infoClient->deviceAdd([
    'device_num' => $deviceNum
]);
echo "DeviceAdd =====> ";
print_r($resda);

// GetDeviceModeWorkInfo
$resmwi = $infoClient->getDeviceModeWorkInfo([
    'device_num' => $deviceNum
]);
echo "GetDeviceModeWorkInfo =====> ";
print_r($resmwi);

// GetDeviceModeWork1Info
$resm1i = $infoClient->getDeviceModeWork1Info([
    'device_num' => $deviceNum
]);
echo "GetDeviceModeWork1Info =====> ";
print_r($resm1i);

// GetDeviceModePowerInfo
$resmpi = $infoClient->getDeviceModePowerInfo([
    'device_num' => $deviceNum
]);
echo "GetDeviceModePowerInfo =====> ";
print_r($resmpi);

// GetDeviceModePower1Info
$resdmp = $infoClient->getDeviceModePower1Info([
    'device_num' => $deviceNum
]);
echo "GetDeviceModePower1Info =====> ";
print_r($resdmp);

// DeviceFindList
$resdfl = $infoClient->deviceFindList([
    'page' => 1,
    'page_size' => 20
]);
echo "DeviceFindList =====> ";
print_r($resdfl);

// DeviceDel
$resdd = $infoClient->deviceDel([
    'device_num' => $deviceNum
]);
echo "DeviceDel =====> ";
print_r($resdd);

// DeviceGetMode
$resgd = $infoClient->deviceGetMode([
    'device_num' => $deviceNum
]);
echo "DeviceGetMode =====> ";
print_r($resgd);

// DeviceSaveMode
$ressm = $infoClient->deviceSaveMode([
    'device_num' => $deviceNum
]);
echo "DeviceSaveMode =====> ";
print_r($ressm);

// GetDeviceSettingUserInfo
$ressuf = $infoClient->getDeviceSettingUserInfo([
    'device_num' => $deviceNum
]);
echo "GetDeviceSettingUserInfo =====> ";
print_r($ressuf);

// GetDeviceSettingNotDisturbInfo
$ressndi = $infoClient->getDeviceSettingNotDisturbInfo([
    'device_num' => $deviceNum
]);
echo "GetDeviceSettingNotDisturbInfo =====> ";
print_r($ressndi);

// DeviceFindOne
$resdf = $infoClient->deviceFindOne([
    'device_num' => $deviceNum
]);
echo "DeviceFindOne =====> ";
print_r($resdf);

// GetDeviceSettingOfflineCardInfo
$resdsoci2 = $infoClient->getDeviceSettingOfflineCardInfo([
    'device_num' => $deviceNum
]);
echo "GetDeviceSettingOfflineCardInfo =====> ";
print_r($resdsoci2);



$logClient =  new DeviceLog($client);

// OnlineLog
$resoll = $logClient->onlineLog([
    'device_num' => $deviceNum,
    'page' => 1, 
    'limit' => 10,
]);
echo "OnlineLog =====> ";
print_r($resoll);


$stateClient =  new DeviceState($client);

// DeviceStateRestart
$res = $stateClient->deviceStateRestart([
    'device_nums' => [$deviceNum]
]);
echo "DeviceStateRestart =====> ";
print_r($res);

// DeviceStateOffline
$res = $stateClient->deviceStateOffline([
    'device_nums' => [$deviceNum]
]);
echo "DeviceStateOffline =====> ";
print_r($res);

// DeviceStateOfflineProfit
$res = $stateClient->deviceStateOfflineProfit([
    'device_nums' => [$deviceNum]
]);
echo "DeviceStateOfflineProfit =====> ";
print_r($res);

// DeviceStatePortError
$res = $stateClient->deviceStatePortError([
    'device_nums' => [$deviceNum]
]);
echo "DeviceStatePortError =====> ";
print_r($res);

// DeviceState
$resds = $stateClient->deviceState([
    'device_num' => $deviceNum,
    'port_fields' => ['state', 'eq_used']
]);
echo "DeviceState =====> ";
print_r($resds);

?>
